#include "ToolFactory.h"
#include <iostream>

Tool* ToolFactory::ourTool;

Tool* ToolFactory::createTool(const QString& toolName)
{
	//QImage* myimage = getImage();

	if(ourTool != NULL)
		delete ToolFactory::ourTool;
	if(toolName == "PaintBrush")
		ToolFactory::ourTool = new PaintBrush();
	else if(toolName == "EraserTool")
		ToolFactory::ourTool = new EraserTool();
	else if(toolName == "EyedropperTool")
		ToolFactory::ourTool = new EyeDropper();
	else if(toolName == "ZoomTool")
		ToolFactory::ourTool = new Zoom();
	else if(toolName == "LineTool")
	{
		ToolFactory::ourTool = new LineTool();
		QCursor *customCursor = new QCursor(Qt::CrossCursor);
		//QObject* liveArea = myImage.parent();
		//static_cast<QWidget *>(liveArea)->setCursor(*customCursor);
	}
	else if(toolName == "FunkyLineTool")
		ToolFactory::ourTool = new FunkyLineTool();
	else if(toolName == "TypeTool")
	    ToolFactory::ourTool = new TypeTool();
	else if(toolName == "FillTool")
		ToolFactory::ourTool = new FillTool();
	else if(toolName == "BasicShapeTool"){
		ToolFactory::ourTool = new BasicShapeTool();
	}
	else if(toolName == "filterBrushTool")
		ToolFactory::ourTool = new FilterBrush();
	return ToolFactory::ourTool;
}